package com.wmh.baseservice.common.utils;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;

/**
 * @author 谢骏
 * @date 2023/3/16 13:59
 * 雪花id工具类
 **/
public class SnowFlakeIdUtil {

    public static Long generate(){
        Snowflake snowflake = IdUtil.getSnowflake(2, 2);
        return snowflake.nextId();
    }

    public static Long generate(int workerId, int datacenterId){
        return IdUtil.getSnowflake(workerId,datacenterId).nextId();
    }
}
